<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue事件参数传递</title>
    <script src ='./js/vue.js'></script>
</head>
<body>
    <div id="app"> 
        <h2>{{msg}}</h2>
        <h2>{{count}}</h2>
        <h2>用户名：{{user.name}};性别：{{user.sex}}</h2>
        <button @click="changeCount(5,'zs','男')">改变count为指定的值</button>
    </div>
</body>
</html>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            msg: 'Vue事件参数传递',
            count: 0,
            user:{},
        },
        methods: {
            //点击修改count的值
            changeCount(num,...user) {
                this.count = num;
                console.log(user);
                this.user.name = user[0];
                this.user.sex = user[1];
            }
           
        }
    })
</script>